﻿using Microsoft.Owin;
using Microsoft.Owin.FileSystems;
using Microsoft.Owin.StaticFiles;
using Owin;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.Http;

namespace SAM.Framework.Owin.NET40
{
    public class StartUp
    {
        public void Configuration(IAppBuilder app)
        {
            //staticfile
            string rootPath = Path.Combine(Directory.GetCurrentDirectory(), "webroot");
            app.UseStaticFiles(new StaticFileOptions()
            {
                FileSystem = new PhysicalFileSystem(rootPath)
            });

            //webapi
            var httpConfiguration = new HttpConfiguration();
            httpConfiguration.Routes.MapHttpRoute("default", "api/{controller}/{action}");
            app.UseWebApi(httpConfiguration);
        }
    }
}
